#!/usr/bin/env python
#-*- coding:utf-8 -*-

def openfile_read(username,password):
	with open('1.txt','rU') as f:
		a=[]
		b={}
		for i in f.readlines():
			l=i.strip('\n')
			a.append(l)
		f.close()
		for i in xrange(0,len(a),2):
			if i==(len(a)-1):
				break
			b[a[i]]=a[i+1]
		if username in b:
			if b[username]==password:
				return 1
			else:
				return 0
		return 0
	return 0
def openfile_write(username,password):
	with open('1.txt','a') as f:
		a=u'\n'
		f.write(username.decode('utf-8'))
		f.write(a)
		f.write(password.decode('utf-8'))
		f.write(a)
		f.close()
	return 1




